<?php
include('HTGPage.class.php');

$page = new HTGPage();
/* @var $utils Utils */
$utils = $page->myUtils;

if($page->isLoggedIn()) {
	sleep(2); //sometimes the server is so fast we can't retrieve the id
	$memberships = $utils->getMembership($_REQUEST['m_id']);
	error_log("memberships: " . count($memberships));
	$membership = $memberships[0];
	$memUid = $membership['m_u_id'];
	if($_SESSION['m_u_id'] == $memUid) {
		$page->content .= $utils->get_include_contents("Thank you. You should receive an email confirmation shortly. Enjoy your membership.");
		$page->content .= $utils->get_include_contents("thankyouLinks.html");
		
	} else {
		//HERE THE MEMBER IS TRYING TO VIEW A THANK YOU PAGE FOR A MEMBERHISP THAT DOESN'T VELONG TO THEIR ACCOUNT.
		$page->redirectTo('nfl.php');
		die();
	}
} else { //end if logged in
	//THE USER IS NOT LOGGED IN HERE
	$page->redirectTo('home.php');
	die();
}
$page->display();

?>